/*
 * Unit.cc
 *
 *  Created on: Mar 9, 2011
 *      Author: topcoder
 */

#include "LengthUnit.h"
#include "string.h"
#include "iostream"
using namespace std;

const unsigned int RATIO_INCH_TO_BASE_UNIT = 1;
const unsigned int RATIO_FEET_TO_BASE_UNIT = 12*RATIO_INCH_TO_BASE_UNIT;
const unsigned int RATIO_YARD_TO_BASE_UNIT = 3*RATIO_FEET_TO_BASE_UNIT;
const unsigned int RATIO_MILE_TO_BASE_UNIT = 1760*RATIO_YARD_TO_BASE_UNIT;

//static LengthUnit* inch=NULL;
//static LengthUnit* feet=NULL;
//static LengthUnit* yard=NULL;
//static LengthUnit* mile=NULL;

LengthUnit::LengthUnit(const unsigned int ratio2BaseUnit, const string name):Unit(ratio2BaseUnit,name)
{
}

LengthUnit& LengthUnit:: getInch()
{
    static LengthUnit inch(RATIO_INCH_TO_BASE_UNIT, "INCH");
    return inch;
}

LengthUnit& LengthUnit:: getFeet()
{
    static LengthUnit feet(RATIO_FEET_TO_BASE_UNIT, "FEET");
    return feet;
}

LengthUnit& LengthUnit:: getYard()
{
    static LengthUnit yard(RATIO_YARD_TO_BASE_UNIT, "YARD");
    return yard;
}

LengthUnit& LengthUnit:: getMile()
{
    static LengthUnit mile(RATIO_MILE_TO_BASE_UNIT, "MILE");
    return mile;
}



